package com.java.control;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.java.bean.UserInfoBean;
import com.java.model.UserInfoModel;
import com.java.utils.EasyFactory;

/**
 * Servlet implementation class UserInfoModifyJumpControl
 */
@WebServlet("/UserInfoModifyJumpControl")
public class UserInfoModifyJumpControl extends HttpServlet {
	private static final long serialVersionUID = 1L;

	/**
	 * @see HttpServlet#service(HttpServletRequest request, HttpServletResponse
	 *      response)
	 */
	protected void service(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		// 接收前台form表单的数据
		// 从request中获取id主键值
		String strUserId = request.getParameter("uid");
		// 调用model层查询该id的所有的记录信息
		UserInfoBean userInfoB = EasyFactory.getNewInstance(UserInfoModel.class).queryUserInfoById(strUserId);
		// 将查询结果缓存到session中
		request.getSession().setAttribute("modifyUserInfoBean", userInfoB);
		// 跳转到修改页面
		request.getRequestDispatcher("WEB-INF/pages/userInfo/UserInfoModify.jsp").forward(request, response);
	}

}
